﻿using System.Diagnostics;
using Dcm.ConfigMapAttributes;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Dcm.Tests.ConfigMapAttributes
{
    [TestClass]
    public class AssemblyPathTests
    {
        [TestInitialize()]
        public void Startup()
        {
            Debug.WriteLine(AssemblyPath.GetAssemblyPath());
        }

        [TestMethod]
        public void AssemblyPathHappy()
        {
            const string Expected = "Success";
            const string Fail = "ShouldNotExist";
            var actual = DynamicConfigurationManager.DynamicConfigurationManager.AppSettings["assemblyPathKey2"];
            if (actual == Fail)
            {
                Assert.Fail("Regardless of environment, result should never be " + Fail);
            }
            else
            if (Expected != actual)
            {
                Assert.Inconclusive(Utilities.UnreliableTest);
            }
            else
                Assert.AreEqual(Expected, actual);
        }

        [TestMethod]
        public void AssemblyPathNonMatch()
        {
            const string Expected = null;
            var actual = DynamicConfigurationManager.DynamicConfigurationManager.AppSettings["assemblyPathKey"];
            Assert.AreEqual(Expected, actual);
            
        }
    }
}
